/**
 * This class models a DieCup with instances 
 */
import java.util.*;
public class DieCup{
    List<Die> dies= new ArrayList<Die>();
    int highest = 0;
    /**
     * constructs a DieCup with 2 dies, and sideCount number of sides on each die.
     */
    public DieCup(){
        addDies(2, 6);
    }
    public DieCup(int dieCount){
        dies = new ArrayList<Die>();
        
        
        addDies(dieCount, 6);
    }
    /**
     * construct a DieCup with dieCount number of dies, and a sideCount number of Sides on each die.
     */
    /**
     * empties the DieCup
     */
    private void empty(){
        Die.resetDieCount();
        dies.clear();
    }
    /**
     * empties the cup, and adds a dieCount number of dies with sideCount number of sides on each die.
     */
    public void addDies(int dieCount, int sideCount){
        empty();
        for(int i = 0 ; i < dieCount ; i ++)
            dies.add(new Die(sideCount));
    }
    /**
     * rolls the dies, returning the result of each die, the total die sum, and records your record.
     */
    public void roll(){
        for(Die d : dies)
            d.roll();
            
        if(getHighest() < getEyes())
            setHigest(getEyes());
        
    }
    /**
     * Get the result from last cast.
     */
    public int getEyes(){
        int sum = 0;
        for(Die d : dies)
            sum += d.getEyes();
        return sum;
    }
    /**
     * Gets the last highest dieroll
     */
    public int getHighest(){
        return highest;
    }
    /**
     * boilderplate method for correct codingstyle
     */
    private void setHigest(int newhigest){
        highest = newhigest;
    }
    /**
     * resets the "highest" die rol
     */
    public void resetHighest(){
        highest = 0;
    }
}